<?php
use Common\Common\GlobalParam;

function fc_clear_all()
{
    S('user_list', NULL);
}

function fc_get_user_list()
{
    $data = S('user_list');
    if (empty($data)) {
        $model = M('v_user');
        $data = S('user_list');
        if (empty($data)) {
            $data = $model->where('status>=0')->select();
        }
        S('user_list', $data, 86400);
    }
    return $data;
}

function fc_get_user($user_id)
{
    $data = fc_get_user_list();
    foreach ($data as $user) {
        if ($user['id'] == $user_id) {
            return $user;
        }
    }
    return null;
}

function fc_get_user_account($user_id)
{
    $data = fc_get_user($user_id);
    if (!empty($data)) {
        return $data['account'];
    }
    return '';
}
